const mongoose = require('mongoose');


async function dbConnect(config) {
    try {
        const db = config.db;
        const url = `mongodb://${db.username}:${db.password}@${db.server}:${db.port}/${db.database}`;

        mongoose.connect(url, {

        })
        console.log('Connected to MongoDB');

    } catch (error) {
        console.error('Failed to connect to MongoDB', error);
        throw error;
    }
}


module.exports = {
    connect: dbConnect,
};